<!--
 * @Author: zi.yang
 * @Date: 2021-03-12 18:46:38
 * @LastEditors: zi.yang
 * @LastEditTime: 2021-03-12 18:50:34
 * @Description: In User Settings Edit
 * @FilePath: \vue-music\src\components\state2\test-computed.vue
-->

<template>
  <div>computed :{{ count }} , {{ double }}</div>
</template>

<script>
import {
  computed, reactive, toRefs,
} from '@vue/composition-api';

export default {
  name: 'test-computed',
  setup() {
    const state = reactive({
      count: 1,
      double: computed(() => state.count * 2),
    });

    setInterval(() => { state.count += 1; }, 1900);

    return toRefs(state);
  },
};

</script>

<style scoped>
</style>
